//
//  HNSH_TongZhengCell.m
//  HNSH_SingleProject
//
//  Created by 李宇廷 on 2023/5/29.
//

#import "HNSH_TongZhengCell.h"

@interface HNSH_TongZhengCell ()

/* bgView */
@property (nonatomic, strong) UIView *bgView;
/* leftLabel */
@property (nonatomic, strong) UILabel *leftLabel;
/* rightLabel */
@property (nonatomic, strong) UILabel *rightLabel;
/* bottomLine */
@property (nonatomic, strong) UIView *bottomLine;

@end

@implementation HNSH_TongZhengCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor colorWithHexString:@"#101010"];
        [self configView];
    }
    return self;
}

- (void)setModel:(HNSH_TongZhengItemModel *)model {
    _model = model;
    self.leftLabel.text = model.left_text;
    self.rightLabel.text = model.right_text;
}

- (void)configView {
    [self.contentView addSubview:self.bgView];
    [self.bgView addSubview:self.leftLabel];
    [self.bgView addSubview:self.rightLabel];
    [self.bgView addSubview:self.bottomLine];
}

#pragma mark lazy
- (UIView *)bgView {
    if (!_bgView) {
        _bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, 44)];
        _bgView.backgroundColor = [UIColor colorWithHexString:@"#101010"];
    }
    return _bgView;
}

- (UILabel *)leftLabel {
    if (!_leftLabel) {
        _leftLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 5, 200, 34)];
        _leftLabel.text = @"";
        _leftLabel.textColor = [UIColor colorWithHexString:@"#FFEDD6"];
        _leftLabel.font = [UIFont systemFontOfSize:14];
    }
    return _leftLabel;
}

- (UILabel *)rightLabel {
    if (!_rightLabel) {
        _rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.bgView.width-220, 5, 200, 34)];
        _rightLabel.text = @"";
        _rightLabel.textColor = [UIColor appWhiteLabelColor];
        _rightLabel.font = [UIFont boldSystemFontOfSize:18];
        _rightLabel.textAlignment = NSTextAlignmentRight;
    }
    return _rightLabel;
}

- (UIView *)bottomLine {
    if (!_bottomLine) {
        _bottomLine = [[UIView alloc]initWithFrame:CGRectMake(20, 43.5, self.bgView.width-40, 0.5)];
        _bottomLine.backgroundColor = [UIColor colorWithHexString:@"#101010"];
    }
    return _bottomLine;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
